package org.example.enums;

public enum EJobType {

    DEPLOY(1, "deploy"),
    UNINSTALL(2, "uninstall");

    private int jobType;
    private String jobName;

    EJobType(int jobType, String jobName) {
        this.jobType = jobType;
        this.jobName = jobName;
    }

    public int getJobType() {
        return jobType;
    }

    public String getJobName() {
        return jobName;
    }

    public static EJobType getByJobType(int jobType) {
        EJobType rs = null;
        for (EJobType jobTypeEnum : EJobType.values()) {
            if (jobTypeEnum.getJobType() == jobType) {
                rs = jobTypeEnum;
                break;
            }
        }
        if (rs == null) throw new RuntimeException("jobType is not exist");
        return rs;
    }
}
